<?php
namespace cubox;

class Cache{
    protected $config;

    public function __construct(array $config){
        
        if (!isset($config['expire'])) $config['expire'] = 0;
        if (!isset($config['prefix'])){
            $config['prefix'] = '';
        }
       
        $this->config = $config;
    }


    public function getExpire($expire){
        return $this->config['expire'];
    }

    public function setExpire($expire){
        $this->config['expire'] = $expire;
    }

    public function getPrefix(){
        return $this->config['prefix'];
    }

    public function setPrefix($prefix){
        $this->config['prefix'] = $prefix;
    }



    public function get($key){
        return null;
    }

   
    public function set($key, $value, $expire = 0){
        return null;
    }

    public function exists($key){
        return false;
    }

    public function delete($key){
        return null;
    }

    public function clear(){
        return null;
    }

    public function getFrontName(string $split = '/'){
       return self::frontTitle($this->config);
    }


    
    public static function frontTitle($config){
        unset($config['driver']);
        unset($config['expire']);
        unset($config['prefix']);
        unset($config['password']);
        return implode('-',array_values($config));
    }
    public static function configParams():array{
        return [];
    }

    public function __call($name, $arguments)
    {
        throw new \Exception('Cache Error:'.$name.' function does not exist');
    }
}